import instance from '../../utils/axios'

function getLabelName() {
    return instance({
        url: '/v1_0/channels',
        method: 'get'
    })
}

export {
    getLabelName
}
// 获取首页详情列表
function getArticlelists({
    channel_id,
    timestamp
}) {
    return instance({
        url: '/v1_0/articles',
        method: 'get',
        params: {
            channel_id,
            timestamp,
            with_top: 1
        }
    })
}
// 获取详情页接口
function getArticleInfo(id) {
    return instance({
        url: `/v1_0/articles/${id}`,
        method: 'get'
    })
}

// 添加关注
function addFollowing({
    target
}) {
    return instance({
        url: '/v1_0/user/followings',
        method: 'post',
        data: {
            target
        }
    })
}

// 取消关注
function removeFollowing({
    target
}) {
    return instance({
        url: `/v1_0/user/followings/${target}`,
        method: 'delete',

    })
}

// 添加点赞
function addLikings(
    target
) {
    return instance({
        url: '/v1_0/article/likings',
        method: 'post',
        data: {
            target
        }
    })
}

// 取消点赞
function removeLikings(
    target
) {
    return instance({
        url: `/v1_0/article/likings/${target}`,
        method: 'delete',

    })
}

// 对文字不喜欢
function unLikings(target) {
    return instance({
        url: '/v1_0/article/dislikes',
        method: 'post',
        data: {
            target
        }
    })
}

function removeunLikings(
    target
) {
    return instance({
        url: `/v1_0/article/dislikes/${target}`,
        method: 'delete',
    })
}

// 获取联想建议
function getSuggestion(q) {
    return instance({
        url: '/v1_0/suggestion',
        Method: 'get',
        params: {
            q
        }
    })
}

export {
    getSuggestion
}
export {
    getArticlelists
}
export {
    getArticleInfo
}
export {
    addFollowing,
    removeFollowing
}
export {
    addLikings,
    removeLikings,
    unLikings,
    removeunLikings
}